NAME
/precompiled/mutex - mutex locks

DESCRIPTION
/precompiled/mutex is a precompiled Pike program that implements mutal exclusion locks. Mutex locks are used to prevent multiple threads from simultaneously execute sections of code which accesses or changes shared data. The basic operations for a mutex is locking and unlocking, if a thread attempts to lock an already locked mutex the thread will sleep until the mutex is unlocked.

NOTA BENE
Mutex locks are only available on systems with POSIX threads support.


NAME
lock - lock the mutex

SYNTAX
object mutex->lock();

DESCRIPTION
This function attempts to lock the mutex, if the mutex is already locked current thread will sleep until the lock is unlocked by some other thread. The value returned is the 'key' to the lock, which the key is destructed or has no more references the lock will automatically be unlocked.


NAME
trylock - try to lock the mutex

SYNTAX
object mutex->trylock();

DESCRIPTION
This function preforms the same operation as lock(), but if the mutex is already locked zero will be returned instead of sleeping until the lock is unlocked.